import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/14 12:28
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            List<int[]> list = new ArrayList<>();
            // 去到一半
            for (int i = 1; i <= n / 2 ; i++) {
                if (isSu(i) && isSu(n - i)) {
                    list.add(new int[]{i, n - i});
                }
            }
            int x = 0, y = 0;
            int max = Integer.MAX_VALUE;
            for (int[] a: list) {
                if (Math.abs(a[0] - a[1]) < max) {
                   max = Math.abs(a[0] - a[1]);
                   x = a[0];
                   y = a[1];
                }
            }
            System.out.println(x);
            System.out.println(y);
        }
    }
    public static boolean isSu(int n) {
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}
